<?php
use \PsiFramework\Classes\Util\UI\Printer;
use \PsiFramework\Classes\Util\UI\HTML;

$entry = $response->getAttribute("entry");
$category = $response->getAttribute("category");
if (is_null($category) && !is_null($entry)) $category = $entry->getCategory();
?>
<article id="cont-princ" class="cols">
    <div style="float:right; text-align:right;"><?php echo HTML::link($languageManager->getText('PREVIEW'), 'action=Preview&entry_id='.$entry->getId(), array('class'=>'popup')); ?></div>
    <h1>
        <?php Printer::display($languageManager->getText('GENERAL_INFORMATION')); ?>
    </h1>
    <h4>
        <?php Printer::display($languageManager->getText($category->getProfile()->getText())); ?>
    </h4>
    <form
        class="editForm"
        method="POST"
        action="<?php Printer::display(HTML::linkHref('action=SaveProfile'));?>">
        <input
            type="hidden"
            name="form_id"
            value="entry" />
        <input
            type="hidden"
            name="entry_id"
            value="<?php if (!is_null($entry)) Printer::display($entry->getId()); ?>" />
        <input
            type="hidden"
            name="category_id"
            value="<?php if (!is_null($category)) Printer::display($category->getId()); ?>" />

        <fieldset class="typeLeft required">
            <label for="name">
                <?php Printer::display($languageManager->getText('NAME')) ?> : 
            </label>
            <span class="firstInput">
                <?php if (!is_null($entry)) Printer::display($entry->getName()); ?>
            </span>
        </fieldset>

        <fieldset class="typeLeft required">
            <label for="address">
                <?php Printer::display($languageManager->getText('ADDRESS')) ?> : 
            </label>
            <input
                class="firstInput"
                type="text"
                id="address"
                name="address"
                value="<?php if (!is_null($entry)) Printer::display($entry->getAddress()); ?>"
                required="required" />
        </fieldset>

        <fieldset class="typeLeft required">
            <label for="city">
                <?php Printer::display($languageManager->getText('CITY')) ?> : 
            </label>
            <input
                class="firstInput"
                type="text"
                id="city"
                name="city"
                value="<?php if (!is_null($entry)) Printer::display($entry->getCity()); ?>"
                required="required" />
        </fieldset>

        <fieldset class="typeLeft required">
            <label for="zip">
                <?php Printer::display($languageManager->getText('ZIP')) ?> : 
            </label>
            <input
                class="firstInput"
                type="text"
                id="zip"
                name="zip"
                value="<?php if (!is_null($entry)) Printer::display($entry->getZip()); ?>"
                required="required" />
        </fieldset>

        <fieldset class="typeLeft required">
            <label for="tel">
                <?php Printer::display($languageManager->getText('TELEPHONE')) ?> : 
            </label>
            <span class="firstInput">
                <?php if (!is_null($entry)) Printer::display($entry->getTel()); ?>
            </span>
        </fieldset>
        
        <fieldset class="typeLeft required">
            <label for="fax">
                <?php Printer::display($languageManager->getText('FAX')) ?> : 
            </label>
            <span class="firstInput">
                <input
                    class="firstInput"
                    type="text"
                    id="fax"
                    name="fax"
                    value="<?php if (!is_null($entry)) Printer::display($entry->getFax()); ?>" />
            </span>
        </fieldset>
        
        <fieldset class="typeLeft required">
            <label for="mobile">
                <?php Printer::display($languageManager->getText('MOBILE')) ?> : 
            </label>
            <span class="firstInput">
                <input
                    class="firstInput"
                    type="text"
                    id="mobile"
                    name="mobile"
                    value="<?php if (!is_null($entry)) Printer::display($entry->getMobile()); ?>" />
            </span>
        </fieldset>
        
        <fieldset class="typeLeft required">
            <label for="tel2">
                <?php Printer::display($languageManager->getText('TELEPHONE2')) ?> : 
            </label>
            <span class="firstInput">
                <input
                    class="firstInput"
                    type="text"
                    id="tel2"
                    name="tel2"
                    value="<?php if (!is_null($entry)) Printer::display($entry->getTel2()); ?>" />
            </span>
        </fieldset>

        <hr />

        <fieldset class="floatRight">
            <input
                type="reset"
                name="reset"
                value="<?php Printer::display($languageManager->getText('CANCEL')); ?>">
            <input
                type="submit"
                name="inscription"
                value="<?php Printer::display($languageManager->getText('SAVE_MODIFICATIONS')); ?>">
        </fieldset>
    </form>
</article>
